fix(postgrest): correct order() overload typing for referenced tables#2025
Open
DevanshTyagi04 wants to merge 1 commit intosupabase:masterfrom
Open
fix(postgrest): correct order() overload typing for referenced tables#2025DevanshTyagi04 wants to merge 1 commit intosupabase:masterfrom
DevanshTyagi04 wants to merge 1 commit intosupabase:masterfrom
Conversation
mandarini
approved these changes
Feb 4, 2026
steve-chavez
reviewed
Feb 4, 2026
Comment on lines
-75
to
-89
| order<ColumnName extends string & keyof Row>( | ||
| column: ColumnName, | ||
| options?: { ascending?: boolean; nullsFirst?: boolean; referencedTable?: undefined } | ||
| ): this | ||
| order( | ||
| column: string, | ||
| options?: { ascending?: boolean; nullsFirst?: boolean; referencedTable?: string } | ||
| ): this | ||
| /** | ||
| * @deprecated Use `options.referencedTable` instead of `options.foreignTable` | ||
| */ | ||
| order<ColumnName extends string & keyof Row>( | ||
| column: ColumnName, | ||
| options?: { ascending?: boolean; nullsFirst?: boolean; foreignTable?: undefined } | ||
| ): this |
Member
There was a problem hiding this comment.
Not sure if this will produce the intended behavior. @avallete Could you help review 🙏 ?
Member
There was a problem hiding this comment.
The overload are here to hint Typescript into correct auto-completion. Without this I think you'll never have autocomplete within the function arg 🤔
avallete
requested changes
Feb 19, 2026
Member
avallete
left a comment
There was a problem hiding this comment.
What's the underneath issue being resolved here ? The type overrides are here to allow autocompletion of the column name by typescript if it extends a column in infered Row.
If it doesn't, they you're still allowed to use a pure string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔍 Description
This PR fixes TypeScript overload typing for the
order()method when used with referenced tables inpostgrest-js.What changed?
order()method overload typings to properly supportreferencedTableforeignTabletyping remains backward-compatibleWhy was this change needed?
The existing overloads caused incorrect or confusing TypeScript inference when ordering by referenced tables, even though the feature works correctly at runtime. This fix aligns the type definitions with actual PostgREST behavior and improves developer experience.
Closes #971
📸 Screenshots/Examples
No UI changes. Type-level fix only.
🔄 Breaking changes
📋 Checklist
npx nx format📝 Additional notes
This change is limited to type definitions and does not affect runtime behavior or generated queries.